//
//  ScrollView.m
//  UI_06homewor循环滚动 放大缩小
//
//  Created by dllo on 16/6/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ScrollView.h"

@interface ScrollView ()<UIScrollViewDelegate>

//@property(nonatomic, retain)UIImage *image;

@end



@implementation ScrollView

-(instancetype)initWithFrame:(CGRect)frame withPictureName:(NSString *)name
{
    self = [super initWithFrame:frame];
    if (self) {
//        self.image = [UIImage imageNamed:name];
        
        UIImageView *imageView =[[UIImageView alloc]initWithImage:[UIImage imageNamed:name]];
        imageView.frame = self.frame;
        [self addSubview:imageView];
        
        
        [self setPropertys];
        
        self.delegate = self;
        [imageView release];
        
    }
    return self;
}

-(void)setPropertys{
    self.contentSize = CGSizeMake(CGRectGetWidth(self.frame), 0);
    
    self.showsHorizontalScrollIndicator = NO;
    self.showsVerticalScrollIndicator = NO;
    
    self.maximumZoomScale = 2;
    self.minimumZoomScale = 0.5;
    
}

-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
    return self.subviews.firstObject;
}

@end
